kind: Service
apiVersion: v1
metadata:
  name: csi-disk-provisioner
  namespace: kube-system
  labels:
    app: csi-disk-provisioner
spec:
  selector:
    app: csi-disk-provisioner
  ports:
    - name: dummy
      port: 12345

---
kind: StatefulSet
apiVersion: apps/v1beta1
metadata:
  name: csi-disk-provisioner
  namespace: kube-system
spec:
  serviceName: "csi-disk-provisioner"
  replicas: 1
  template:
    metadata:
      labels:
        app: csi-disk-provisioner
    spec:
      tolerations:
      - operator: "Exists"
      nodeSelector:
        node-role.kubernetes.io/master: ""
      priorityClassName: system-node-critical
      serviceAccount: alicloud-csi-plugin
      hostNetwork: true
      containers:
        - name: csi-provisioner
          image: {{ alicloud_csi_provisioner_repo }}:{{ alicloud_csi_provisioner_tag }}
          args:
            - "--provisioner=diskplugin.csi.alibabacloud.com"
            - "--csi-address=$(ADDRESS)"
            - "--feature-gates=Topology=True"
            - "--volume-name-prefix=pv-disk"
            - "--v=5"
          env:
            - name: ADDRESS
              value: /socketDir/csi.sock
          imagePullPolicy: "IfNotPresent"
          volumeMounts:
            - name: disk-provisioner-dir
              mountPath: /socketDir
        - name: csi-diskplugin
          image: {{ alicloud_csi_diskplugin_repo }}:{{ alicloud_csi_diskplugin_tag }}
          imagePullPolicy: "IfNotPresent"
          args :
            - "--endpoint=$(CSI_ENDPOINT)"
            - "--v=5"
            - "--driver=diskplugin.csi.alibabacloud.com"
          env:
            - name: CSI_ENDPOINT
              value: unix://socketDir/csi.sock
            - name: ACCESS_KEY_ID
              value: "{{ ali_access_key_id }}"
            - name: ACCESS_KEY_SECRET
              value: "{{ ali_access_key_secret }}"
            - name: MAX_VOLUMES_PERNODE
              value: "15"
          volumeMounts:
            - mountPath: /var/log/
              name: host-log
            - mountPath: /socketDir/
              name: disk-provisioner-dir
            - name: etc
              mountPath: /host/etc
      volumes:
        - name: disk-provisioner-dir
          emptyDir: {}
        - name: host-log
          hostPath:
            path: /var/log/
        - name: etc
          hostPath:
            path: /etc
  updateStrategy:
    type: RollingUpdate